package game;
/**
 * <p>The names for each side that is able to play Chess.</p>
 * 
 * @author Trevor Bastian
 * @date February 16, 2010
 * @version 1.0
 * 
 * @author Mark Kelly
 * @date February 25, 2010
 * @version 3.0
 *
 */
public enum Team {
	BLACK,
	WHITE;
	
	/**
	 * <p>Return an enum representing the opposing team.</p>
	 * @return - the opposite {@code Team}
	 */
	public Team other() {
		return (this == Team.WHITE) ? Team.BLACK : Team.WHITE;
	}
	
	/**
	 * <p>Returns a character representation of this {@code Team}</p>
	 * @return 'B' for black 'W' for white
	 */
	public String toLetter() {
		return (this == Team.WHITE) ? "W" : "B";
	}
	
	/**
	 * <p>Returns a {@code String} representation of this {@code Team}</p>
	 * @return 'White' or 'Black'
	 */
	public String toString() {
		return (this == Team.WHITE) ? "White" : "Black";
	}
	
	/**
	 * Takes a string and returns the team
	 * @param team string representation of team
	 * @return Team representation of team
	 */
	public static Team fromString (String team) {
		return (team.equals(Team.WHITE.toString()) ? Team.WHITE : Team.BLACK );
	}
}
